package com.mckillion.Exercise6;

import java.util.ArrayList;
import java.util.List;

public class Drawing extends Sketch {

	private List<SketchedItem> drawings;
	
	public Drawing(String description) {
		super(description, 0);
		drawings = new ArrayList<SketchedItem>();
	}
	
	public void addDrawing(SketchedItem drawing) {
		drawings.add(drawing);
	}
	
	public void removeDrawing(SketchedItem drawing) {
		drawings.remove(drawing);
	}
	
	public Drawing[] getDrawing() {
		return drawings.toArray(new Drawing[drawings.size()]);
	}
	
	@Override
	public String toString() {
		String var = ("Consists of: " + drawings + " Total cost: " + getCost());
		return var;
	}
	
	@Override
	public int getCost() {
		int total = 0;
		for (SketchedItem drawing : drawings){
			total += drawing.getCost();
		}
		return total;
	}

}
